package com.ruoyi.web.controller.app;

import com.ruoyi.business.domain.TDevice;
import com.ruoyi.business.service.ITDeviceService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * App端 设备查询接口
 *
 * @author your_name
 */
@RestController
@RequestMapping("/app/device")
public class AppDeviceController extends BaseController {

    @Autowired
    private ITDeviceService deviceService;

    /**
     * 获取附近的碾米机
     */
    @GetMapping("/nearby")
    public AjaxResult getNearbyDevices(
            @RequestParam("longitude") Double longitude,
            @RequestParam("latitude") Double latitude) {
        List<TDevice> nearbyDevices = deviceService.findNearbyDevices(longitude, latitude);
        return AjaxResult.success(nearbyDevices);
    }
}